home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / Internet / TurboTCP 2.1 ƒ / TurboTCP core / CTCPDriver.h < prev    next >
Encoding:
Text File  |  1995-01-05  |  2.8 KB  |  101 lines  |  [TEXT/MMCC]

  1. //
  2. // CTCPDriver.h
  3. //
  4. //    TurboTCP library
  5. //    TCP driver interface class
  6. //
  7. //    Copyright © 1993-95, FrostByte Design / Eric Scouten
  8. //
  9.  
  10.  
  11. #pragma once
  12.  
  13. #include "TurboTCP.buildflags.h"
  14. #include "TurboTCP.types.h"
  15. #include <OSUtils.h>
  16.  
  17. #if TurboTCP_UH2
  18.     #include <MacTCP.h>
  19. #else
  20.     #include <MacTCPCommonTypes.h>
  21. #endif
  22.  
  23.  
  24. class CTCPAsyncCall;
  25. class CTCPDriver;
  26. class CTCPStream;
  27. class CTCPResolverCall;
  28.  
  29.  
  30. //***********************************************************
  31.  
  32. class CTCPDriver {
  33.  
  34. // This object performs all of the housekeeping associated with the MacTCP driver.
  35. // It keeps track of all currently open streams and handles the delayed-processing of
  36. // MacTCP completions and notifications. It is also responsible for seeing that MacTCP is
  37. // in a stable state (i.e. no streams left open, DNR closed) before the application quits.
  38.  
  39. // NOTE: This class is intended for the internal use of other TurboTCP classes only.
  40. // Accordingly, all of its methods are declared private and friend class declarations are
  41. // used to make its members available as appropriate. No user class should have a reason
  42. // to use this object, nor should this object be subclassed. 
  43.  
  44. // In a future version of TurboTCP, this class will be made an abstract class to support
  45. // MacTCP and Open Transport versions of the driver object.
  46.  
  47.     friend class CTCPAsyncCall;
  48.     friend class CTCPStream;
  49.     friend class CTCPResolverCall;
  50.     friend class UTurboTCP;
  51.  
  52. private:
  53.                         CTCPDriver();
  54.     virtual                ~CTCPDriver() {}            // don’t use this -- use Dispose() instead
  55.     void                    Dispose();
  56.  
  57.     // event handling
  58.     
  59.     Boolean                ProcessOneNetEvent();
  60.  
  61.     // TCP verification routines
  62.     
  63.     ip_addr                GetIPAddr();
  64.     Boolean                CheckTCPDriver();
  65.     Boolean                CheckResolver();
  66.     short                GetTCPRefNum();
  67.     void                    FetchIPAddr();
  68.  
  69.     // tracking active streams/resolvers
  70.  
  71.     void                    RegisterActiveStream(CTCPStream* theStream);
  72.     void                    RegisterActiveResolver(CTCPResolverCall* theResolver);
  73.     void                    RemoveActiveStream(CTCPStream* theStream);
  74.     void                    RemoveActiveResolver(CTCPResolverCall* theResolver);
  75.     Boolean                CheckResolverLimit();
  76.     
  77.  
  78.     // data members
  79.  
  80. private:
  81.     static CTCPDriver*    gTCPDriver;                // global reference to this object
  82.     Boolean                hasMacTCP;                // is there a MacTCP driver available?
  83.     Boolean                hasResolver;                // is the DNR code segment available?
  84.     short                myTCPRefNum;                // MacTCP driver’s ioRefNum
  85.     ip_addr                myIPAddress;                // our IP address
  86.     QHdr                    asyncQueue;                // interrupt-event queue
  87.     QHdr                    activeStreamList;            // list of active TCP streams
  88.     QHdr                    activeResolverList;            // list of active DNR calls
  89.     short                activeResolverCount;        // number of active DNR calls
  90.  
  91.  
  92.     // private constants and types
  93.     
  94.     enum {
  95.         maxResolverCalls = 8,                // maximum DNR calls open simultaneously
  96.         DLOG_TCPDelayedQuit = 23010            // delay message
  97.     };
  98.  
  99.     
  100. };
  101.